﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using UnityEngine;

public class PlayMusicOnEnable : MonoBehaviour
{
    public AudioClip clip;
    public AudioClip introClip;

    private void OnEnable()
    {
        base.StartCoroutine(this.Play());
    }

    [DebuggerHidden]
    private IEnumerator Play()
    {
        return new <Play>c__Iterator15 { <>f__this = this };
    }

    [CompilerGenerated]
    private sealed class <Play>c__Iterator15 : IDisposable, IEnumerator, IEnumerator<object>
    {
        internal object $current;
        internal int $PC;
        internal PlayMusicOnEnable <>f__this;
        internal AudioSource <audioSource>__0;

        [DebuggerHidden]
        public void Dispose()
        {
            this.$PC = -1;
        }

        public bool MoveNext()
        {
            uint num = (uint) this.$PC;
            this.$PC = -1;
            switch (num)
            {
                case 0:
                    this.<audioSource>__0 = this.<>f__this.GetComponent<AudioSource>();
                    if (this.<>f__this.introClip == null)
                    {
                        break;
                    }
                    this.<audioSource>__0.clip = this.<>f__this.introClip;
                    this.<audioSource>__0.loop = false;
                    this.<audioSource>__0.Play();
                    this.$current = new WaitForSeconds(this.<>f__this.introClip.length);
                    this.$PC = 1;
                    return true;

                case 1:
                    break;

                default:
                    goto Label_00CF;
            }
            this.<audioSource>__0.clip = this.<>f__this.clip;
            this.<audioSource>__0.loop = true;
            this.<audioSource>__0.Play();
            this.$PC = -1;
        Label_00CF:
            return false;
        }

        [DebuggerHidden]
        public void Reset()
        {
            throw new NotSupportedException();
        }

        object IEnumerator<object>.Current
        {
            [DebuggerHidden]
            get
            {
                return this.$current;
            }
        }

        object IEnumerator.Current
        {
            [DebuggerHidden]
            get
            {
                return this.$current;
            }
        }
    }
}

